#pragma once
#include "Poller.h"
#include <vector>

templete <int N>
class MultiPoller {
 static_assert(N > 1, "N must be greater than 1");
public:
    MultiPoller() {
        for (int i = 0; i < N; ++i) {
            pollers_.push_back(new Poller());
        }
    }
    ~MultiPoller() {
        for (auto poller : pollers_) {
            delete poller;
        }
    }

    void AddEvent(int fd, uint32_t events, void* ptr) {
        pollers_[fd % N]->AddEvent(fd, events, ptr);
    }
    void ModEvent(int fd, uint32_t events, void* ptr) {
        pollers_[fd % N]->ModEvent(fd, events, ptr);
    }
    void DelEvent(int fd) {
        pollers_[fd % N]->DelEvent(fd);
    }
    void Run() {}

private:
    std::vector<Poller*> pollers_;
};
